import java.net.ServerSocket;
import java.net.Socket;


public class Server extends Thread{
	private ServerSocket dateServer;
	public static void main(String argv[]) throws Exception {
		/*Pcap obj=new Pcap(0);
		System.out.println("start");
		obj.start();
		sleep(10000);
		obj.coleta=false;
		obj.interrupt();
		System.out.println("stop");
		
		System.out.println(obj.generateXMLtoInterface());*/
		//Pcap.getListInterface();
		//Traceroute  rt=new Traceroute(0);
		//rt.traceRT("74.125.234.24",this);
		new Server();
	
		//long id=parseIP.buscaIDLocation("177.41.8.172");
		//System.out.println(id);
		//System.out.println(parseIP.hash_idLocation_LatLong.get(id)+"!!!!!!!!!!!!");
		//System.out.println(ParseIP.convertIPtoDecimal("10.1.2.3"));
	}
	public Server() throws Exception {
		dateServer = new ServerSocket(3001);
		System.out.println("Server listening on port 3001.");
		this.start();
	}
	public void run() {
		while (true) {
			try {
				System.out.println("Waiting for connections.");
				Socket client = dateServer.accept();
				System.out.println("Accepted a connection from: "
						+ client.getInetAddress());
				Connection connection = new Connection(client);
				//connection.sendMessage("Server says HI!");
			} catch (Exception e) {
				System.out.println(e);
			}
		}
	}
}
